# -*- coding: UTF-8 -*-
from  lxml  import  etree
pars = {'url':'E:/python/lxml.html','path':'//div','numer':0}
def gettree(obj):
    print obj
    dom = obj['url']
    mypath = obj['path']
    if 'numer' in obj.keys() and type(obj['numer']) == int:
        numer = obj['numer']
        print 1
    else:
        numer = 0
        print 0
    domtree = etree.HTML(open(dom).read())
    domnode = domtree.xpath(mypath)
    domnodenew =domnode[numer].xpath('string()') 
    print domnodenew,etree.tostring(domnode[numer])
gettree(pars)
    #domnode = domtree.xpath('string()')